package com.cnb.telepathytalk;

import android.os.Bundle;

import com.cnb.telepathytalk.dto.RoomInfoDTO;
import com.cnb.telepathytalk.fragment.AlarmPickFragment;
import com.cnb.telepathytalk.fragment.AlarmSettingFragment;
import com.cnb.telepathytalk.fragment.BackgroundSettingFragment;
import com.cnb.telepathytalk.fragment.BlockFriendManagerFragment;
import com.cnb.telepathytalk.fragment.JoinMemberListFragment;
import com.cnb.telepathytalk.fragment.NoticeFragment;
import com.cnb.telepathytalk.fragment.PasswordSettingFragment;
import com.cnb.telepathytalk.fragment.RegInfoInputFragment;
import com.cnb.telepathytalk.fragment.RegNumInputFragment;
import com.cnb.telepathytalk.fragment.RegPhoneInputFragment;
import com.cnb.telepathytalk.fragment.SetChatingFragment;

public class ShowFragmentActivity extends DefaultActivity {
	public static final String INTENT_KEY_ITEM = "ShowFragmentActivity";
	public static final String INTENT_KEY_TYPE = "TYPE_KEY";

	public static final int TYPE_REGISTRATION = 0;
	public static final int TYPE_DEVICE_CHANGE = 1;
	public static final int TYPE_COMPLETE_SMS = 2;
	public static final int TYPE_SET_CHATING = 10;
	public static final int TYPE_SET_CHATING_BACKGROUND = 11;
	public static final int TYPE_BLOCK_PERSON_LIST = 13;
	public static final int TYPE_PERSON_LIST = 12;
	public static final int TYPE_NOTICE = 21;
	public static final int TYPE_SET_ALARM_SETTING = 31;
	public static final int TYPE_SET_PASSWORD_SETTING = 35;
	public static final int TYPE_ALARM_PICK = 32;

	public RoomInfoDTO item;
	public int type;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_fragment);

		item = (RoomInfoDTO) getIntent().getSerializableExtra(INTENT_KEY_ITEM);
		type = getIntent().getIntExtra(INTENT_KEY_TYPE, -1);

		switch (type) {
		case TYPE_REGISTRATION:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new RegPhoneInputFragment()).commit();
			break;

		case TYPE_DEVICE_CHANGE:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new RegNumInputFragment()).commit();
			break;

		case TYPE_COMPLETE_SMS:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new RegInfoInputFragment()).commit();
			break;

		case TYPE_SET_CHATING:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new SetChatingFragment()).commit();
			break;

		case TYPE_SET_CHATING_BACKGROUND:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new BackgroundSettingFragment()).commit();
			break;

		case TYPE_PERSON_LIST:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new JoinMemberListFragment()).commit();
			break;

		case TYPE_BLOCK_PERSON_LIST:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new BlockFriendManagerFragment()).commit();
			break;

		case TYPE_NOTICE:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new NoticeFragment()).commit();
			break;

		case TYPE_SET_ALARM_SETTING:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new AlarmSettingFragment()).commit();
			break;

		case TYPE_SET_PASSWORD_SETTING:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new PasswordSettingFragment()).commit();
			break;

		case TYPE_ALARM_PICK:
			getSupportFragmentManager().beginTransaction().replace(R.id.fragment, new AlarmPickFragment()).commit();
			break;
		}
	}
}